layui.use(['element', 'form', 'layer'], function () {
    let layer = layui.layer;
    let element = layui.element;
    let form = layui.form;
});

layui.use(['form', 'layer'], function () {
    let form = layui.form;
    let layer = layui.layer;
});

$(document).ready(function () {


    $(".del_btn").click(function () {

        let bookId = $(this).val();
        console.log('book', bookId)

        //页面层
        layer.open({
            type: 1 //Page层类型
            , skin: 'layui-layer-molv'
            , area: ['380px', '270px']
            , title: ['续期', 'font-size:18px']
            , btn: ['保存', '取消']
            , shadeClose: true
            , shade: 0 //遮罩透明度
            , content: $("#window")
            , yes: function () {
                adminMessage(bookId);
            }
        });


    });
});

function adminMessage(bookId) {
    // let data = $('#updateForm').serialize();

    let data = $("#userName").val().toString().trim();
    console.log(data)

    $.ajax({
        async: false,
        type: 'post',
        url: '/add/adminMessage',
        data:{id: bookId, adminText: data},
        success: function (data) {
            layer.msg("回复成功", {time: 1500, icon: 1});

            setTimeout(function () {
                // 重新刷新页面
                location.reload();
            }, 1500)
        },
        error: function (data) {
            alert("添加失败");
        }
    });
};













